Skip to content

rapids-github-run-id: raise error if no run ID found - #193

Merged
jameslamb merged 2 commits into
mainfrom
fail-on-missing-run-id
Jun 9, 2025
Merged

jameslamb merged 2 commits into
mainfrom
fail-on-missing-run-id

Conversation

@jameslamb

Copy link
Copy Markdown
Member

Fixes #192

Today, rapids-github-run-id can silently and "successfully" (exit code 0) return an empty string.

This is never desirable in RAPIDS CI... that empty string leads to artifact-downloading grabbing whatever the latests uploaded artifacts happened to be, which can lead to problems of the form "not building/testing against the packages I intended to build/test against".

This can be difficult to recognize if pulling the wrong artifact doesn't result in outright failures.

To avoid that, this PR proposes raising a big loud error in the situation where no run ID is found.

Notes for Reviewers

How I tested this

Fails in the expected way for a SHA that does not exist:

run_id=$(
    PATH="$(pwd)/tools:${PATH}" \
    RAPIDS_BUILD_TYPE=branch \
    RAPIDS_REPOSITORY="rapidsai/rmm" \
    RAPIDS_REF_NAME="branch-25.08" \
    RAPIDS_SHA="some-nonsense-that-does-not-exist" \
    RAPIDS_BUILD_WORKFLOW_NAME="build.yaml" \
      rapids-github-run-id
)

# [rapids-github-run-id] ERROR: failed to find a GitHub Actions run for [RAPIDS_BUILD_TYPE=branch, RAPID_REPOSITORY=rapidsai/rmm, RAPIDS_REF_NAME=branch-25.08, RAPIDS_SHA=some-nonsense-that-does-not-exist]

echo $?
# 1

Succeeds as expected for a real commit:

run_id=$(
    PATH="$(pwd)/tools:${PATH}" \
    RAPIDS_BUILD_TYPE=branch \
    RAPIDS_REPOSITORY="rapidsai/rmm" \
    RAPIDS_REF_NAME="branch-25.08" \
    RAPIDS_SHA="e5b1c01b8600e11872268484af3176a3eeeb8d03" \
    RAPIDS_BUILD_WORKFLOW_NAME="build.yaml" \
      rapids-github-run-id
)

echo $?
# 0

echo $run_id
# 15470752435

That exactly corresponds to https://github.com/rapidsai/rmm/actions/runs/15470752435/job/43554265779, which is correct.

@jameslamb
jameslamb requested a review from a team as a code owner June 5, 2025 18:33
@jameslamb
jameslamb requested review from msarahan and removed request for a team June 5, 2025 18:33
@jameslamb jameslamb added bug Something isn't working non-breaking Introduces a non-breaking change labels Jun 5, 2025
@jameslamb
jameslamb merged commit f253696 into main Jun 9, 2025
@ajschmidt8
ajschmidt8 deleted the fail-on-missing-run-id branch June 9, 2025 20:10
rapids-bot Bot pushed a commit that referenced this pull request Mar 10, 2026
I've been using `rapids-get-pr-artifact` a lot recently, for rapidsai/build-planning#257

Today, one of my PRs for that briefly caused `cudf` to briefly exceed its GitHub API limits: NVIDIA/cudf#21671 (comment)

This proposes some fixes to `rapids-get-pr-artifact` in the future:

* error out of a unique GitHub Actions run ID can't be determined from the inputs
  - *(instead of passing an empty string to `gh run download`, which causes it to page over **all CI runs GitHub's history retains**)*
* limit initial search for runs to just `pr.yaml` workflow
  - *(optionally overridable by env variable `RAPIDS_BUILD_WORKFLOW_NAME`)*

These should make `rapids-get-pr-artifact` faster and, more importantly, use many fewer GitHub API calls.

## Notes for Reviewers

### Haven't I seen this before?

Yep! Similar changes were made in `rapids-github-run-id`:

* #193
* #170

`rapids-get-pr-artifact` doesn't use `rapids-github-run-id` because its behavior of "use environment variable `GITHUB_RUN_ID` if it's available" is undesirable when you're trying to workflow runs in a repo other than the one `rapids-get-pr-artifact` is currently running in.

### How I tested this

Tested on NVIDIA/cudf#21671, with NVIDIA/cudf@c058c43

Authors:
  - James Lamb (https://github.com/jameslamb)

Approvers:
  - Gil Forsyth (https://github.com/gforsyth)

URL: #249
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

bug Something isn't working non-breaking Introduces a non-breaking change

Projects

None yet

Development

Successfully merging this pull request may close these issues.

rapids-github-run-id can silently return nothing

2 participants